package com.booby.algorithm.insertion;

import com.booby.algorithm.utils.Utils;

/**
 * 功能描述: 插入排序，从小到大，交换位置
 *
 * @author: lizt
 * @date: 2020/8/22 16:41
 **/

public class MinToMax {

    private static Integer[] arr = {5,7, 3, 2,6, 1, 9, 8,6, 7, 4};
    public static void sorted(Integer[] arr){

        for (int i = 0; i < arr.length - 1; i++) {
            int currentIndex = i + 1;
            for (int j = 0; j < currentIndex; j++) {
                if (arr[currentIndex] < arr[j]){
                    Utils.swap(arr, currentIndex, j);
                }
            }
        }
        //Utils.print(arr);
    }
    public static void main(String[] args) {
        sorted(arr);
    }
}
